/*
 * Copyright(c) 2020-2100 万达信息股份有限公司 版权所有
 * WONDERS INFORMATION CO., LTD. ALL RIGHTS RESERVED.
 */

package com.wondersgroup.entity;

import cn.afterturn.easypoi.excel.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author: huym
 * @version: 1.0
 * @date: 2020/11/25
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@ExcelTarget("user")
public class User implements Serializable {
    @ExcelIgnore
    @Excel(name = "编号",orderNum = "0",needMerge = true)
    private String id;
    @Excel(name = "姓名",orderNum = "1",needMerge = true)
    private String name;
    @Excel(name = "年龄",orderNum = "3",suffix = "岁",needMerge = true)
    private Integer age;
    @Excel(name = "生日",width = 30,format = "yyyy-MM-dd",orderNum = "2",needMerge = true)
    private Date bir;
    @Excel(name = "状态",orderNum = "4",replace = {"激活_1","锁定_0"},needMerge = true)
    private String status;
    @Excel(name = "爱好",orderNum = "10",width = 30,needMerge = true)
    private List<String> habbys;
    @Excel(name = "爱好",orderNum = "5",width = 30,needMerge = true)
    private String habbysStr;
    // ExcelEntity的id属性可以和Card中ExcelTarget的id不同
    @ExcelEntity(id = "card",name = "身份信息",show = true)
    private Card card;
    @ExcelCollection(id = "order",name = "订单信息",orderNum = "8")
    private List<Order> orders;
    @Excel(name = "头像",width = 20,height = 20,type = 2,orderNum = "9",needMerge = true)
    private String photo;

    public String getHabbysStr() {
        return StringUtils.join(habbys,",");
    }
}
